package cn.tedu.jxc.service.impl;

import cn.tedu.jxc.mapper.LogMapper;
import cn.tedu.jxc.pojo.entity.Log;
import cn.tedu.jxc.service.LogService;
import cn.tedu.jxc.web.JsonPage;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;

    @Override
    public void addLogInfo(Log log) {
        logMapper.addLogInfo(log);
    }

    @Override
    public JsonPage<Log> getList(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<Log> list = logMapper.getList();
        return JsonPage.restPage(new PageInfo<>(list));
    }
}
